﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using Palsta.Core.exp;

namespace Palsta.Core.Manifest
{


    class Caculation
    {
        public enum RefreshType
        {
            none,
            onChange,
            onValidate,
            beforeChange
        }

        #region Members

        private String target;
        private String expressionText;
        private RefreshType refresh;

        #endregion

        #region Constructors

        public Caculation()
            : this("", "", RefreshType.onChange)
        {
            ;
        }

        public Caculation(String tar, String exp, RefreshType refresh)
        {
            this.target = tar;
            this.expressionText = exp;
            this.refresh = refresh;
        }

        #endregion

        #region Accessors

        public virtual String Target
        {
            get
            {
                return this.target;
            }
            set
            {
                this.target = value;
            }
        }

        public virtual String ExpressionText
        {
            get
            {
                return this.expressionText;
            }
            set
            {
                this.expressionText = value;
            }
        }

        public virtual Caculation.RefreshType Refresh
        {
            get
            {
                return this.refresh;
            }
            set
            {
                this.refresh = value;
            }
        }



        #endregion

        #region Override Operators

        public override bool Equals(object o)
        {
            if (o is String)
            {
                return this.target.Equals((String)o);
            }
            return false;
        }

        public override int GetHashCode()
        {
            return 0;
        }

        #endregion
    }
}
